﻿using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TakeoutMangesWeb
{
    public partial class AdminAddEnterprise : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                if (Session["name"] == null)
                {
                    Response.Redirect("AdminLogin.aspx");

                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Enterprise ep = new Enterprise();
            ep.EnterpriseName = txtName.Text.Trim();
            ep.EnterpriseTel = txtTEL.Text.Trim();
            ep.EnterpriseAdress = txtAdress.Text.Trim();
            ep.Isdelete = 0;
            int r = TakeoutMangesBLL.EnterpriseBLL.InsertEnterprise(ep);
            if (r > 0)
            {
                ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('添加成功！');location.href='AdminterIndex.aspx';</script>");

            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('添加失败！');</script>");
                return;
            }
        }
    }
}